﻿using ARchGL.Platform.Mpp;
using ARchGL.Platform.Mpp.InputModels;
using Castle.Core.Logging;
using Microsoft.AspNetCore.Hosting;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using WebApiClient;

namespace ARchGL.Platform.Application
{
    public class MppAppService : PlatformAppServiceBase, IMppAppService
    {
        #region 实例

        private readonly IMppProjectApi mppProjectApi;

        private readonly ILogger logger;
        private readonly IHostingEnvironment env;

        public MppAppService(
            IMppProjectApi _mppProjectApi,
            IHostingEnvironment _env,
            ILogger _logger
            )
        {
            mppProjectApi = _mppProjectApi;
            logger = _logger;
            env = _env;
        }

        #endregion

        /// <summary>
        /// 创建进度
        /// </summary>
        /// <param name="projectId"></param>
        /// <param name="input"></param>
        /// <returns></returns>
        public ITask<AjaxResponseMpp<CreateMppDto>> CreateMppProject(Guid projectId, CreateMppProjectInput input)
        {
            return mppProjectApi.CreateMppProject(projectId, input);
        }

        /// <summary>
        /// 修改进度
        /// </summary>
        /// <param name="projectId"></param>
        /// <param name="input"></param>
        /// <returns></returns>
        public ITask<AjaxResponseMpp<dynamic>> ModifyMppProject(Guid projectId, ModifyMppProjectInput input)
        {
            return mppProjectApi.ModifyMppProject(projectId, input);
        }

        /// <summary>
        /// 删除进度项
        /// </summary>
        /// <param name="projectId"></param>
        /// <returns></returns>

        public ITask<AjaxResponseMpp<dynamic>> RemoveMppPorject(Guid projectId)
        {
            return mppProjectApi.RemoveMppPorject(projectId);
        }

        #region MppTask

        /// <summary>
        /// 新增/修改/删除项目进度任务
        /// </summary>
        /// <param name="projectId"></param>
        /// <param name="input"></param>
        /// <returns></returns>
        public ITask<AjaxResponseMpp<dynamic>> PutMppPorjectTask(Guid projectId, dynamic input)
        {
            return mppProjectApi.PutMppPorjectTask(projectId, input);
        }

        #endregion
    }
}
